package com.wxy.config;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

import com.wxy.domain.myException;

@ControllerAdvice
public class exceptionHandlerConfig {
	@ExceptionHandler(Exception.class)
	public ModelAndView exceptionHandler(Exception exception) {
		ModelAndView modelAndView=new ModelAndView();
		modelAndView.setViewName("error");
		modelAndView.addObject("exception", exception.getMessage());
		return modelAndView;
	}
	@ExceptionHandler(myException.class)
	public ModelAndView exceptionHandler2(myException myException) {
		ModelAndView modelAndView=new ModelAndView();
		modelAndView.setViewName("error");
		modelAndView.addObject("exception", myException.getMessage());
		return modelAndView;
	}
}
